{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "3a089e6b",
   "metadata": {},
   "source": [
    "----------------\n",
    "* 2022/9/5\n",
    "* python学习记录"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a6f0c106",
   "metadata": {},
   "source": [
    "# 本周学习目标\n",
    "### 1.模块\n",
    "### 2.变量\n",
    "### 3.循环遍历\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ab60200a",
   "metadata": {},
   "source": [
    "## 1.模块 (标准库）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "7583b4d4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1662345972.8752742"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import time\n",
    "time.time()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "e11a0454",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1662345973.511617"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 纪元（1970.1.1）\n",
    "# 时间戳\n",
    "time.time()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "0fae4e23",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "time.struct_time(tm_year=2022, tm_mon=9, tm_mday=5, tm_hour=10, tm_min=47, tm_sec=4, tm_wday=0, tm_yday=248, tm_isdst=0)"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time.localtime()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "79d9707e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "time.struct_time(tm_year=2022, tm_mon=9, tm_mday=5, tm_hour=2, tm_min=53, tm_sec=25, tm_wday=0, tm_yday=248, tm_isdst=0)"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time.gmtime()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "3cf06859",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'Mon Sep  5 10:59:07 2022'"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time.asctime(time.localtime())"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "aa0ab2cc",
   "metadata": {},
   "source": [
    "## 2.模块(开源模块）\n",
    "> 1. 因为代码开源\n",
    "> 2. 集合全领域的需求\n",
    "> 2. 按照国际标准开放的模块\n",
    "> 4. 资源地址"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d471f2fc",
   "metadata": {},
   "source": [
    "## 3.模块（自定义模块）\n",
    "> 1. 不愿意开源的有一定知识产权的（开发API租用形式开放）\n",
    "> 2. 自己用的，写的也不怎么好的，开源出去丢人的"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3e0aa015",
   "metadata": {},
   "source": [
    "# 变量\n",
    "> 1 变量名只能是字母，数字，或者下划线"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "d2e8a89a",
   "metadata": {},
   "outputs": [],
   "source": [
    "网三_01 =\"xiao hong\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "1c8c7dd3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'xiao hong'"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "网三_01"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "e0510cb2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2000331640048"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "id (网三_01)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "b51b9bc3",
   "metadata": {},
   "outputs": [],
   "source": [
    "网三01age = 28"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "5790986a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "28"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "网三01age"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "d845f196",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "180000001 180000001\n",
      "180000006 180000001\n"
     ]
    }
   ],
   "source": [
    "# 案例（关于变量）\n",
    "网三01id =\"180000001\"\n",
    "网三02id =网三01id\n",
    "print(网三01id, 网三02id)\n",
    "网三01id =\"180000006\"\n",
    "print(网三01id,网三02id)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2b3f0983",
   "metadata": {},
   "source": [
    "# 课后作业\n",
    "* 1.课本第四页\n",
    "* 2思考if和from"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "8921ba64",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Not an odd minute\n"
     ]
    }
   ],
   "source": [
    "# p4\n",
    "from datetime import datetime\n",
    "\n",
    "odds =[1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59]\n",
    "\n",
    "right_this_minute = datetime.today().minute\n",
    "\n",
    "if right_this_minute in odds:\n",
    "    print(\"This minute seems a little odd.\")\n",
    "else:\n",
    "    print(\"Not an odd minute\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "08b4293e",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
